package com.anabur.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import com.anabur.persistent.Rubro;
import com.anabur.system.AafAbstractDAO;



public class RubroDAO extends AafAbstractDAO{
	
	public RubroDAO(SessionFactory sessionFac){
		super(sessionFac);
	}
	
	protected String getNameOfPojo() {
		return Rubro.class.getSimpleName();
	}
	
	public List<Rubro> getRubroList() throws Exception{
		List<Rubro> list=null;
		Session sess = null;
		try{
			sess = sessionFac.openSession();
			Query query = sess.createQuery("from Rubro");
			list = (List) query.list();
			sess.close();
		}catch (Exception e) {
			sess.close();
			throw e;
		}	
		return list;
	}
	
	
}
